<template>
  <div>
    <template>
      <div>
        <div v-for="permission in permissions" :key="permission.id">
          <label>
            <input type="checkbox" :value="permission.id" v-model="selectedPermissions">
            {{ permission.name }}
          </label>
        </div>
      </div>
    </template>

    <script>
      export default {
        data() {
          return {
            permissions: [
              { id: 1, name: '添加用户' },
              { id: 2, name: '删除用户' },
              { id: 3, name: '修改用户' },
              { id: 4, name: '查询用户' }
            ],
            newPermissions: [
              { id: 1, name: '添加用户' },
              { id: 4, name: '查询用户' }
            ],
            selectedPermissions: []
          }
        },
        created() {
          this.selectedPermissions = this.newPermissions.map(permission => permission.id)
        }
      }
    </script>
  </div>
</template>

<script>
export default {
  data() {
    return {}
  }
}
</script>

<style scoped>

</style>